package base;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;

public class BaseDriver {
	public AndroidDriver driver=null;
	String urlStr="http://127.0.0.1:4723/wd/hub";
	@BeforeClass
	public void initDriver() throws MalformedURLException {
		DesiredCapabilities cap=new DesiredCapabilities();
		cap.setCapability("platformName","Andoird");
		cap.setCapability("deviceName","127.0.0.1:62001");
		cap.setCapability("appPackage","njust.dzh.fitnesssystem");
		cap.setCapability("appActivity",".App.LoginActivity");
		cap.setCapability("noReset",true);
		driver=new AndroidDriver(new URL(urlStr),cap);
	}
	@AfterClass
	public void quiteDriver() {
		if(driver!=null) {
			driver.quit();
		}
	}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
}
